/*
 * Grasp.h
 *
 *  Created on: Jul 23, 2012
 *      Author: hugo
 */

#ifndef GRASP_H_
#define GRASP_H_
#include "LocalSol.h"
#include "Solution.h"
#include "Vertex.h"
#include "Instance.h"
#include <vector>
typedef pair<int,pair<vector<Vertex*>,float> > build_rcl_elem;
typedef pair<int,vector<Vertex*> > rcl_elem;
typedef pair<int,float > pool_elem;
class Grasp {
public:
	Grasp(Instance*,unsigned int);
	void start(int,int);
	double get_time();
	double get_stddev();
	Solution* get_solution();
	virtual ~Grasp();
private:
	unsigned int seed;
	Instance* instance;
	double stddev;
	double time;
	LocalSol *bestsol;
	LocalSol* construct(vector<Vertex*> pool,int it);
	void localsearch(LocalSol** sol);
	void full_localsearch(LocalSol** sol);
	vector<Vertex*> build_pool(int size);
	vector<Vertex*> build_random_pool(unsigned int length);
	vector<rcl_elem> rcl(LocalSol*);
	vector<Vertex*> bfs(LocalSol* sol,int v,int depth);
	vector<Vertex*> bfs(LocalSol* sol,Vertex* v,int depth);
	vector<Vertex*> perform_bfs(int *visited,int v_id,int depth);
};

#endif /* GRASP_H_ */
